import socket, struct

class Clinet():

    def __init__(this):
        HOST='localhost'
        PORT=8001
        this.s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
        this.s.connect((HOST,PORT))
    
    def send(this, tag, message):
        tag, message = bytes(tag, "utf-8"), bytes(message, "utf-8")

        data = struct.pack("2s18s", tag, message)
        print(data)
        this.s.sendall(data)


c = Clinet()
while True:
    fmt = input("请输入格式【TS、CS、CA、TE、RH、CH】")
    sts = input("请输入消息")
    print('------------------------------')
    print('------------------------------')
    c.send(fmt, sts)